package com.ciei.dpagm.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.ciei.dpagm.common.enums.RuleBaseTypeEnum;
import com.ciei.dpagm.common.enums.RuleSetTypeEnum;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

import java.io.Serializable;
import java.util.Date;

/**
 * @author wangyan
 * @since 2023-03-08
 */
@TableName(value = "common_rule_set")
public class RuleSet implements Serializable {

    private static final long serialVersionUID=1L;

    @TableId(type = IdType.AUTO)
    private Integer ruleSetId;
    private Integer driverLibraryId;
    private Integer chipId;
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private String ruleSetName;
    private RuleSetTypeEnum type;
    private RuleBaseTypeEnum ruleBaseType;
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;
    @TableField(fill = FieldFill.UPDATE)
    private Date updateTime;
    private Integer creatorId;
    private Integer updateUserId;
    @TableLogic
    @TableField(fill = FieldFill.INSERT)
    private Integer isDelete;

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    public Integer getRuleSetId() {
        return ruleSetId;
    }

    public void setRuleSetId(Integer ruleSetId) {
        this.ruleSetId = ruleSetId;
    }

    public Integer getDriverLibraryId() {
        return driverLibraryId;
    }

    public void setDriverLibraryId(Integer driverLibraryId) {
        this.driverLibraryId = driverLibraryId;
    }

    public Integer getChipId() {
        return chipId;
    }

    public void setChipId(Integer chipId) {
        this.chipId = chipId;
    }

    public String getRuleSetName() {
        return ruleSetName;
    }

    public void setRuleSetName(String ruleSetName) {
        this.ruleSetName = ruleSetName;
    }

    public RuleSetTypeEnum getType() {
        return type;
    }

    public void setType(RuleSetTypeEnum type) {
        this.type = type;
    }

    public RuleBaseTypeEnum getRuleBaseType() {
        return ruleBaseType;
    }

    public void setRuleBaseType(RuleBaseTypeEnum ruleBaseType) {
        this.ruleBaseType = ruleBaseType;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public Integer getCreatorId() {
        return creatorId;
    }

    public void setCreatorId(Integer creatorId) {
        this.creatorId = creatorId;
    }

    public Integer getUpdateUserId() {
        return updateUserId;
    }

    public void setUpdateUserId(Integer updateUserId) {
        this.updateUserId = updateUserId;
    }

    public Integer getIsDelete() {
        return isDelete;
    }

    public void setIsDelete(Integer isDelete) {
        this.isDelete = isDelete;
    }

    /**
     * 深拷贝
     * @return
     * @throws JsonProcessingException
     */
    public RuleSet deepCopy() throws JsonProcessingException {
        ObjectMapper objectMapper = new ObjectMapper();
        return objectMapper.readValue(objectMapper.writeValueAsString(this), RuleSet.class);
    }
}
